<template>
  <!--设备盘点管理-->
  <div style="padding: 20px">
    <el-card class="box-card">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="全部" name="first">
          <div>
            <el-button @click="handleNewTask">新建任务</el-button>
            <el-button @click="handleDelete">删除</el-button>
            <el-button @click="handleClose">关闭</el-button>
            <el-button @click="handleExport">导出</el-button>
            <el-input
              placeholder="请输入设备编号或名称"
              clearable
              prefix-icon="el-icon-search"
              suffix-icon="el-icon-s-cale"
              style="width: 250px; margin-left: 540px"
            />
            <el-popover placement="right" width="400" trigger="click">
              <svg-icon
                icon-class="caiss"
                style="width: 40px; height: 20px"
                class="pointer"
                slot="reference"
              />
            </el-popover>
          </div>
          <el-table :data="filteredData" style="width: 100%; margin-top: 20px">
            <el-table-column type="selection" width="55" />
            <el-table-column prop="序号" label="序号" width="50" />
            <el-table-column label="操作" width="80">
              <template v-slot="scope">
                <el-button type="text" @click="handleView(scope.row)"
                  >查看</el-button
                >
              </template>
            </el-table-column>
            <el-table-column prop="状态" label="状态" />
            <el-table-column prop="任务单号" label="任务单号" />
            <el-table-column prop="任务名称" label="任务名称" />
            <el-table-column prop="任务计划开始时间" label="任务计划开始时间" />
            <el-table-column prop="任务计划结束时间" label="任务计划结束时间" />
            <el-table-column prop="盘点部门" label="盘点部门" />
            <el-table-column prop="盘点人员" label="盘点人员" />
            <el-table-column prop="应盘数量" label="应盘" />
            <el-table-column prop="应盘数量" label="已盘" />
            <el-table-column prop="应盘数量" label="未盘" />
            <el-table-column prop="应盘数量" label="盘盈" />
            <el-table-column prop="应盘数量" label="盘亏" />
            <el-table-column prop="应盘数量" label="完成度" />
          </el-table>
          <el-pagination
            background
            style="margin-top: 20px; text-align: right"
            :page-size="10"
            :total="45"
            layout="prev, pager, next, sizes, total"
            :page-sizes="[10, 20, 30, 50]"
          />
        </el-tab-pane>
        <el-tab-pane label="我的申请" name="second">我的发起</el-tab-pane>
        <el-tab-pane label="我的审批" name="third">我的审批</el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      //卡片信息
      activeName: "first",
      searchText: "",
      data: [
        {
          序号: 1,
          状态: "未开始",
          任务单号: "T016",
          任务名称: "自动化流水线盘点任务",
          任务计划开始时间: "2025-07-12 10:30",
          任务计划结束时间: "2025-07-12 10:30",
          盘点部门: "维修部门",
          盘点人员: "周强",
          应盘数量: 15,
        },
        // 更多数据
      ],
      currentPage: 1,
      pageSize: 10,
    };
  },
  computed: {
    filteredData() {
      return this.data
        .filter((item) => {
          return (
            item.任务单号.includes(this.searchText) ||
            item.任务名称.includes(this.searchText)
          );
        })
        .slice(
          (this.currentPage - 1) * this.pageSize,
          this.currentPage * this.pageSize
        );
    },
    total() {
      return this.data.length;
    },
  },
  methods: {
    //卡片选择信息
    handleClick(tab, event) {
      console.log("卡片", tab, event);
    },
    handleSearch() {
      this.currentPage = 1;
    },
    handleNewTask() {
      // 处理新建任务操作
      this.$router.push({ path: "/sb/chu/pan/xin" });
    },
    handleDelete() {
      // 处理删除操作
    },
    handleView(row) {
      // 查看具体信息
      this.$router.push({ path: "/sb/chu/pan/cha" });
    },
    handleClose() {
      // 处理关闭操作
    },
    handleExport() {
      // 处理导出操作
    },
    handlePageChange(page) {
      this.currentPage = page;
    },
  },
};
</script>

<style>
/* 自定义样式 */
.text {
  font-size: 14px;
}

.item {
  padding: 18px 0;
}

.box-card {
  width: 1210px;
  height: 660px;
  margin-left: 14px;
}
</style>
